//菜单栏的JQ方法
$("#food").on("mouseover", function() {
	$("#topMenu").css({
		display: "block"
	})
})
$("#food").on("mouseout", function() {
	$("#topMenu").css({
		display: "none"
	})
})
$("#topMenu").hover(function() {
		$(this).css({
			display: "block"
		})
	}, function() {
		$(this).css({
			display: "none"
		})
	})
	//右动画
var imgArr = ["../../img/image/pic1.jpg", "../../img/image/pic2.jpg", "../../img/image/pic3.jpg"];
var tgbArr = ["../../img/image/tbg1.png", "../../img/image/tbg2.png", "../../img/image/tbg3.png"];
var TArr = ["../../img/image/t1.png", "../../img/image/t2.png", "../../img/image/t3.png"];
var WArr = ["../../img/image/w1.png", "../../img/image/w2.png", "../../img/image/w3.png"];
var i = 1;
window.onload = function() {
	setInterval(function() {
		$("#middle_left :nth-child(2)").animate({
			top: 0
		}, 500, function() {
			$("#middle_left :nth-child(3)").animate({
				left: 0
			}, 500, function() {
				$("#middle_left :nth-child(4)").animate({
					left: 0
				}, 500, function() {
					setTimeout(function() {
						animateOut();
					}, 3000)
				})
			})
		})
	}, 6000)
}

//图片移出动画
function animateOut() {
	$("#middle_left :nth-child(3)").animate({
		left: "287.55px"
	}, 500, function() {
		$("#middle_left :nth-child(4)").animate({
			left: "287.55px"
		}, 500, function() {
			$("#middle_left :nth-child(2)").animate({
				top: "-156px"
			}, 500, function() {
				$("#middle_left :nth-child(3)").css({
					left: "-287.55px"
				});
				$("#middle_left :nth-child(4)").css({
					left: "-287.55px"
				});
				$("#middle_left :nth-child(1)").animate({
					opacity: 0
				}, 500);
				$("#middle_left :nth-child(1)").attr("src", imgArr[i]);
				$("#middle_left :nth-child(2)").attr("src", tgbArr[i]);
				$("#middle_left :nth-child(3)").attr("src", TArr[i]);
				$("#middle_left :nth-child(4)").attr("src", WArr[i]);
				$("#middle_left :nth-child(1)").animate({
					opacity: 1
				}, 500);
				i++;
				if(i == 3) {
					i = 0;
				}
			})
		})

	})
}

//下方五组图的JQ事件
$(".img1").hover(function() {
	$(".img1").attr("src", "../../img/image/home-box-1_hover.jpg")
}, function() {
	$(".img1").attr("src", "../../img/image/home-box-1_CN.jpg")
})

$(".img2").hover(function() {
	$(".img2").attr("src", "../../img/image/home-box-2_hover.jpg")
}, function() {
	$(".img2").attr("src", "../../img/image/home-box-2_CN.jpg")
})

$(".img3").hover(function() {
	$(".img3").attr("src", "../../img/image/home-box-3_hover.jpg")
}, function() {
	$(".img3").attr("src", "../../img/image/home-box-3_CN.jpg")
})

$(".img4").hover(function() {
	$(this).attr("src", "../../img/image/weibo_hover.jpg")
}, function() {
	$(this).attr("src", "../../img/image/weibo_CN.jpg")
})

$(".img5").hover(function() {
	$(".code").css({
		display: "block"
	})
	$(this).attr("src", "../../img/image/weixin_hover.jpg")
}, function() {
	$(".code").css({
		display: "none"
	})
	$(this).attr("src", "../../img/image/weixin_CN.jpg")
})